home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 39
/
Aminet 39 (2000)(Schatztruhe)[!][Oct 2000].iso
/
Aminet
/
biz
/
swood
/
FW_AllInOne.lha
/
Makros
/
Suchen&Ersetzen
< prev
next >
Wrap
Text File
|
1998-01-18
|
13KB
|
527 lines
/* Optimized with RexxOpt 1.7 */
Parse ARG FW
if ~show('L',"rexxreqtools.library") then
if ~addlib('rexxreqtools.library',0,-30,0) then;do
'ShowMessage 1 1 "Fehler...." "Benötige Libs:rexxreqtools.library" " A B B R U C H ! !" "Okay" "" ""'
exit
end
IF ~show('L','tritonrexx.library') then
IF ~ADDLIB('tritonrexx.library',10,-30,0) THEN;DO
'ShowMessage 2 1 "Fehler...." "Benötige Libs:tritonrexx.library" "" "Abbruch" "" ""'
exit
END
R='0A'X
SIGNAL ON syntax
If open('Hilfe',"S:FW_Paket.prefs","R") then;do
HilfeVerz=readln('Hilfe')
Call Close('Hilfe')
End
else HilfeVerz=''
If FW='' then;do
Address='FinalW'
Options results
STATUS PORTNAME
FW=result
End
Address(FW)
FWP="FinalWriterPubScreen"
lista.0=2
lista.1=' Text '
lista.2=' Code '
liste.0=3
liste.1=' ---- '
liste.2=' Text '
liste.3=' Code '
listb.0=3
listb.1=' ------------- '
listb.2=' Schriftart'
listb.3='Schriftschnitt'
Wort='';dis=1;fo='';spez=0
Texttool
Status PARAPOS
Parse Var result bzeile bspalte ezeile espalte
if ezeile~='' then;do
extract;Wort=result
pos=lastpos(R,Wort)
if pos~=0 then Wort=Left(Wort,pos)
dis=0
Status FontName
fo=result
spez=1
end
dir=''
apptags='TRCA_Name SuchenErsetzen',
'TRCA_LongName "Suchen und Ersetzen"',
'TRCA_Info "für FinalWriter"',
'TRCA_Version "2.1 registered"',
'TRCA_Release "3"',
'TRCA_Date "06.01.98"',
'TAG_END'
windowtags=WindowID(1),
WindowPosition('TRWP_CENTERDISPLAY'),
PubScreenName(FWP),
WindowTitle("Suchen & Ersetzen"),
WindowFlags('TRWF_NOSIZEGADGET|TRWF_NOMINTEXTWIDTH'),
BeginMenu('Projekt'),
MenuItem('Q_Verlassen',104),
BeginMenu('?'),
MenuItem('?_Info',101),
MenuItem('H_Hilfe',103),
'HorizGroupAC',
'SpaceS',
'VertGroupAC',
'SpaceS',
NamedFrameBox('Suchen nach'),
'HorizGroupAC',
'SpaceS',
'VertGroupAC',
'SpaceS',
TextID('A_rt',10),
'SpaceS',
CycleGadget('lista',0,10) 'TRAT_Flags TRCY_RIGHTLABELS TRAT_Value 0',
StringGadget(Wort,11),
'SpaceS',
'EndGroup',
'SpaceS',
'VertGroupAC',
'SpaceS',
TextID('S_pezifikation',12),
'SpaceS',
CycleGadget('listb',spez,12) 'TRAT_Flags TRCY_RIGHTLABELS',
'HorizGroupAC',
GetEntryButton(13) TRAT_DISABLED dis,
StringGadget(fo,14) TRAT_DISABLED dis,
'EndGroup',
'SpaceS',
'EndGroup',
'SpaceS',
'EndGroup',
'Space',
NamedFrameBox('Ersetzen durch'),
'HorizGroupAC',
'SpaceS',
'VertGroupAC',
'SpaceS',
TextID('Ar_t',20),
'SpaceS',
CycleGadget('liste',0,20) 'TRAT_Flags TRCY_RIGHTLABELS TRAT_Value 0',
StringGadget('',21) 'TRAT_DISABLED 1',
'SpaceS',
'EndGroup',
'SpaceS',
'VertGroupAC',
'SpaceS',
TextID('Spe_zifikation',22),
'SpaceS',
CycleGadget('listb',0,22) 'TRAT_Flags TRCY_RIGHTLABELS TRAT_Value 0',
'HorizGroupAC',
GetEntryButton(23) 'TRAT_DISABLED 1',
StringGadget('',24) 'TRAT_DISABLED 1',
'EndGroup',
'SpaceS',
'EndGroup',
'SpaceS',
'EndGroup',
'Space',
'HorizGroupEC',
Button('_Suchen',1),
'SpaceS',
Button('_Ersetzen',2) 'TRAT_DISABLED 1',
'SpaceS',
Button('_Alle',3) 'TRAT_DISABLED 1',
'EndGroup',
'SpaceS',
'EndGroup',
'SpaceS',
'EndGroup',
'EndProject'
app=TR_CREATEAPP('TRCA_Name SuchenErsetzen')
IF app ~='00000000'x THEN;DO
window1=TR_OPENPROJECT(app,windowtags)
IF window1 ~='00000000'x THEN;DO
ende=0
DO WHILE ~ende
CALL TR_WAIT(app,'')
DO WHILE TR_HANDLEMSG(app,'event')
IF event.trm_class='TRMS_NEWVALUE' THEN;DO
SELECT
WHEN event.trm_id=10 THEN;do
what=event.trm_data+1
such=TR_GETATTRIBUTE(window1,11,'TROB_String')
if what=1 then;do
void=SetClip("Cod1",such)
Cod2=GetClip("Cod2")
CALL TR_SETATTRIBUTE(window1,11,'TROB_String',Cod2)
end
if what=2 then;do
void=SetClip("Cod2",such)
Cod1=GetClip("Cod1")
CALL TR_SETATTRIBUTE(window1,11,'TROB_String',Cod1)
end
if what=3 then CALL TR_SETATTRIBUTE(window1,21,'TROB_String','')
End
WHEN event.trm_id=12 THEN;do
what=event.trm_data+1
such=TR_GETATTRIBUTE(window1,14,'TROB_String')
if what=1 then;do
void=SetClip("Spez2",such)
CALL TR_SETATTRIBUTE(window1,13,'TRAT_Disabled',1)
CALL TR_SETATTRIBUTE(window1,14,'TROB_String','')
CALL TR_SETATTRIBUTE(window1,14,'TRAT_Disabled',1)
end
if what=2 then;do
Spez1=GetClip("Spez1")
CALL TR_SETATTRIBUTE(window1,13,'TRAT_Disabled',0)
CALL TR_SETATTRIBUTE(window1,14,'TROB_String',Spez1)
CALL TR_SETATTRIBUTE(window1,14,'TRAT_Disabled',0)
end
if what=3 then;do
void=SetClip("Spez1",such)
Spez2=GetClip("Spez2")
CALL TR_SETATTRIBUTE(window1,14,'TROB_String',Spez2)
end
End
WHEN event.trm_id=20 THEN;do
what=event.trm_data+1
such=TR_GETATTRIBUTE(window1,21,'TROB_String')
if what=1 then;do
void=SetClip("Cod4",such)
CALL TR_SETATTRIBUTE(window1,21,'TROB_String','')
CALL TR_SETATTRIBUTE(window1,21,'TRAT_Disabled',1)
CALL TR_SETATTRIBUTE(window1,2,'TRAT_Disabled',1)
CALL TR_SETATTRIBUTE(window1,3,'TRAT_Disabled',1)
end
if what=2 then;do
Cod3=GetClip("Cod3")
CALL TR_SETATTRIBUTE(window1,21,'TROB_String',Cod3)
CALL TR_SETATTRIBUTE(window1,21,'TRAT_Disabled',0)
CALL TR_SETATTRIBUTE(window1,2,'TRAT_Disabled',0)
CALL TR_SETATTRIBUTE(window1,3,'TRAT_Disabled',0)
end
if what=3 then;do
void=SetClip("Cod3",such)
Cod4=GetClip("Cod4")
CALL TR_SETATTRIBUTE(window1,21,'TROB_String',Cod4)
end
End
WHEN event.trm_id=22 THEN;do
what=event.trm_data+1
such=TR_GETATTRIBUTE(window1,24,'TROB_String')
if what=1 then;do
void=SetClip("Spez4",such)
CALL TR_SETATTRIBUTE(window1,23,'TRAT_Disabled',1)
CALL TR_SETATTRIBUTE(window1,24,'TROB_String','')
CALL TR_SETATTRIBUTE(window1,24,'TRAT_Disabled',1)
end
if what=2 then;do
Spez3=GetClip("Spez3")
CALL TR_SETATTRIBUTE(window1,23,'TRAT_Disabled',0)
CALL TR_SETATTRIBUTE(window1,24,'TROB_String',Spez3)
CALL TR_SETATTRIBUTE(window1,24,'TRAT_Disabled',0)
end
if what=3 then;do
void=SetClip("Spez3",such)
Spez4=GetClip("Spez4")
CALL TR_SETATTRIBUTE(window1,24,'TROB_String',Spez4)
end
End
OTHERWISE NOP
END
END
IF event.trm_class='TRMS_CLOSEWINDOW' THEN ende=1
IF event.trm_class='TRMS_ACTION' THEN;DO
SELECT
WHEN event.trm_id=13 THEN;Do
what=TR_GETATTRIBUTE(window1,12,'TRAT_VALUE')
if what=1 then;do
STATUS NumFonts
Font.0=result
Do i=1 to Font.0
Status FontName i
Font.i=result
End
If Font.0=1 then FontAusw=Font.1
Else Call fontlist
End
if what=2 then;do
Font.0=4
Font.1='Normal'
Font.2='Unterstrichen'
Font.3='Doppelt Unterstrichen'
Font.4='Durchgestrichen'
Call fontlist
End
if fontausw~='' then CALL TR_SETATTRIBUTE(window1,14,'TROB_String',FontAusw)
END
WHEN event.trm_id=23 THEN;Do
what=TR_GETATTRIBUTE(window1,22,'TRAT_VALUE')
if what=1 then;do
nee="FWFonts/SWOLFonts"
dir=rtfilerequest(nee,,"Font auswählen...",,"rt_pubscrname = FinalWriterPubScreen")
End
if what=2 then;do
Font.0=4
Font.1='Normal'
Font.2='Unterstrichen'
Font.3='Doppelt Unterstrichen'
Font.4='Durchgestrichen'
Call fontlist
dir=fontausw
End
if dir~='' then CALL TR_SETATTRIBUTE(window1,24,'TROB_String',dir)
END
WHEN event.trm_id=1 THEN;Do
All=false;Suchen=true
Call program
END
WHEN event.trm_id=2 THEN;Do
All=false;Suchen=false
Call program
END
WHEN event.trm_id=3 THEN;Do
All=true;Suchen=false
Call program
END
WHEN event.trm_id=101 THEN Call rtezrequest("Aus dem Makro-Paket:"||R||R||"Suchen & Ersetzen V2.1 für FW"||R||"© 1998 Heiko Schröder","Danke für Ihre Registrierung.","Info","rt_pubscrname=FinalWriterPubScreen")
WHEN event.trm_id=103 THEN address command "run Multiview PUBSCREEN=FinalWriterPubScreen "||d2c(34)||HilfeVerz||"Suchen&Ersetzen.guide"||d2c(34)
WHEN event.trm_id=104 THEN ende=1
OTHERWISE NOP
END
END
END
END
CALL TR_CLOSEPROJECT(window1)
END
CALL TR_DELETEAPP(app)
END
ELSE
CALL quit('Kann das Fenster nicht öffnen',10)
Exit
program:
code1=TR_GETATTRIBUTE(window1,10,'TRAT_VALUE')
art1=TR_GETATTRIBUTE(window1,12,'TRAT_VALUE')
code2=TR_GETATTRIBUTE(window1,20,'TRAT_VALUE')
art2=TR_GETATTRIBUTE(window1,22,'TRAT_VALUE')
such=TR_GETATTRIBUTE(window1,11,'TROB_String')
suchfont=TR_GETATTRIBUTE(window1,14,'TROB_String')
erse=TR_GETATTRIBUTE(window1,21,'TROB_String')
ersefont=TR_GETATTRIBUTE(window1,24,'TROB_String')
Cursor Left;Cursor Right
if such="" then;do
x=rtezrequest("Bitte Suchwort eingeben","_Achso","FEHLER","rt_pubscrname=FinalWriterPubScreen")
return
end
if art1=2 then;do
Select
When suchfont='Unterstrichen' then suchfont='UnderLine'
When suchfont='Doppelt Unterstrichen' then suchfont='DUnderLine'
When suchfont='Durchgestrichen' then suchfont='StrikeThru'
Otherwise suchfont='Normal'
end
end
if art2=2 then;do
Select
When ersefont='Unterstrichen' then ersefont='UnderLine'
When ersefont='Doppelt Unterstrichen' then ersefont='DUnderLine'
When ersefont='Durchgestrichen' then ersefont='StrikeThru'
Otherwise ersefont='Normal'
end
end
If code1=1 then;do
If (such<0|such>255) then;do
x=rtezrequest("Der Such-Code muß zwischen 1...255 liegen","_Achso","FEHLER","rt_pubscrname=FinalWriterPubScreen")
return
End
If Datatype(such,'N')=1 then such=d2c(such)
Else;do
x=rtezrequest("Bitte den Such-Code eingeben","_Achso","FEHLER","rt_pubscrname=FinalWriterPubScreen")
return
End
End
If code2=2 then;do
If (erse<0|erse>255) then;do
x=rtezrequest("Der Ersetzen-Code muß zwischen 1...255 liegen","_Achso","FEHLER","rt_pubscrname=FinalWriterPubScreen")
return
End
If (erse~=''& Datatype(erse,'N')=1) then erse=d2c(erse)
Else erse=''
End
If All=true then REDRAWOFF
If art1=1 then;do
If suchfont~='' then;do
Call schrift suchfont;suchfont=FontArt
if a~=0 then;do
x=rtezrequest("Der Such-Font ist kein FW typischer Font...","_Achso","FEHLER","rt_pubscrname=FinalWriterPubScreen")
return
end
end
End
If art2=1 then;do
If ersefont~='' then;do
Call schrift ersefont;ersefont=FontArt
if a~=0 then;do
x=rtezrequest("Der Ersetzen-Font ist kein FW typischer Font...","_Achso","FEHLER","rt_pubscrname=FinalWriterPubScreen")
return
end
end
end
address(FW)
Menge=0
SETFIND CASE Same WRAP No
FIND
if art1~=0 then x=rtezrequest("Optionen im FW-Suchen Requester einstellen.","_Getan","ACHTUNG!","rt_pubscrname=FinalWriterPubScreen")
rpl=false
fnd=false
DO until ok~=0
rpl=false
FIND such
ok=RC
if ok=0 then;do
Select
When (suchfont=''&ersefont='') then;do
Type erse
rpl=true
End
When (suchfont=''&ersefont~='') then;do
if art2=1 then;do
Type erse;ShiftDown
do p=1 to Length(erse)
Cursor LEFT
End
End
If art2=1 then Font ersefont
If art2=2 then Style ersefont
rpl=true
End
When (suchfont~=''&ersefont='') then;do
if art1=1 then;do
STATUS FontName
suchfound=result
end
if art1=2 then;do
STATUS FontStyle
suchfound=result
end
if upper(suchfont)=upper(suchfound) then;do
If Suchen=false then;do
Type erse
rpl=true
end
else;do
fnd=true
end
End
End
When (suchfont~=''&ersefont~='') then;do
if art1=1 then;do
STATUS FontName
suchfound=result
end
if art1=2 then;do
STATUS FontStyle
suchfound=result
end
if upper(suchfont)=upper(suchfound) then;do
If Suchen=false then;do
Type erse;ShiftDown
do p=1 to Length(erse)
Cursor LEFT
End
If art2=1 then Font ersefont
If art2=2 then Style ersefont
rpl=true
end
else;do
fnd=true
end
End
End
Otherwise NOP
End
if rpl=true then Menge=Menge+1
End
If (erse=''&Suchen=false) then Delete
If (All=false&rpl=true) then leave
If (All=false&fnd=true) then leave
END
If All=true then;do
REDRAWON
REDRAW
if menge=1 then text="Es wurde "Menge" Ersetzung vorgenommen."
else text="Es wurden "Menge" Ersetzungen vorgenommen."
if menge=0 then text="Der Suchbegriff wurde nicht gefunden."
x=rtezrequest(text||R||"Bitte FW-Suchen-Requester schließen.","_Okay","FERTIG!","rt_pubscrname=FinalWriterPubScreen")
end
Return
schrift:
Cursor Right
Cursor Left
Parse Arg FontArt
Font FontArt
a=RC
If a~=0 then return
Type d2c(32)
STATUS FontPath
FullFontName=result
pos=max(index(FullFontName,':'),lastpos('/',FullFontName))
IF (pos~=0) THEN;do
FontArt=RIGHT(FullFontName,LENGTH(FullFontName)-pos)
END
BackSpace
return
fontlist:
window2=TR_OPENPROJECT(app,WindowID(2),
WindowPosition('TRWP_CENTERDISPLAY'),
PubScreenName(FWP),
WindowTitle("Bitte wählen Sie:"),
'VertGroupAC',
FWListSelC('Font',1,0) 'TRAT_Flags TRLV_ShowSelected',
'EndGroup',
'EndProject')
IF window2 ~='00000000'x THEN;DO
ande=0
DO WHILE ~ande
CALL TR_WAIT(app,'')
DO WHILE TR_HANDLEMSG(app,'event')
IF event.trm_class='TRMS_CLOSEWINDOW' THEN;DO
FontAusw=''
ande=1
End
IF event.trm_class='TRMS_NEWVALUE' THEN;DO
SELECT
WHEN event.trm_id=1 THEN;do
Anz=TR_GETATTRIBUTE(window2,1,'TRAT_VALUE')+1
FontAusw=Font.Anz
ande=1
End
OTHERWISE
NOP
END
END
END
END
CALL TR_CLOSEPROJECT(window2)
END
ELSE
CALL quit('Kann das Fenster nicht öffnen',10)
Return
syntax:
CALL quit('Fehler' rc 'in Zeile' sigl '-' ERRORTEXT(rc)||R||SOURCELINE(sigl)||R||'Bitte informieren Sie den Autor...',20)
quit:
PARSE ARG message,rcode
IF app ~='00000000'x THEN;DO
IF message ~='' THEN
x=rtezrequest(message,"_Okay","ACHTUNG!","rt_pubscrname=FinalWriterPubScreen")
CALL TR_DELETEAPP(app)
END
ELSE;DO
IF message ~='' THEN;DO
SAY message
SAY
OPTIONS PROMPT 'Bitte <RETURN> drücken'
PULL taste
END
END
address command "flushtrx all"
EXIT(rcode)